//
//  DataBaseHandler.h
//  DolphinMusic
//
//  Created by dlios on 15-3-27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>
#import "Album.h"
#import "Song.h"
#import "SongList.h"
#import "FMAlbum.h"

@interface DataBaseHandler : NSObject <NSURLConnectionDownloadDelegate, NSURLConnectionDataDelegate>

{
    sqlite3 *dbPoint;
}

@property (nonatomic, retain)Song *song;
@property (nonatomic, retain)NSMutableData *receiveData;


+ (DataBaseHandler *)shareInstance;
- (void)openDB;
- (void)closeDB;
- (void)creatTableSongCollection;
- (void)creatTableFMalbumCollection;
- (void)creatTableRecentPlay;
- (void)creatTableFilePath;
- (void)creatTableLoading;


- (void)insertFilePath:(NSString *)filePath singer:(NSString *)singer songName:(NSString *)songName songID:(NSString *)songID;

- (void)downLoadSongWithSongID:(NSString *)songID;


- (void)insertSong:(Song *)song;
- (void)insertRecentPlay:(Song *)song;
- (void)insertFMalbum:(FMAlbum *)fmAlbum;

- (void)insertSongName:(NSString *)songName singer:(NSString *)singer songID:(NSString *)songID;

- (void)insertDownLoadingSong:(Song *)song;


- (void)deleteSong:(Song *)song;
- (void)deleteRecentPlayWithSongID:(NSString *)songID;
- (void)deleteFMalbum:(FMAlbum *)fmAlbum;
- (void)deleteTableRecentPlay;
- (void)deleteTableFilePath:(NSString *)songID;
- (void)deleteTableLoading:(NSString *)songID;
- (void)deleteTableFilePath;

- (NSMutableArray *)selectAllInSongCollection;
- (NSMutableArray *)selectAllInFMalbumCollection;

- (NSMutableArray *)selectAllInRecentPlay;
- (NSMutableArray *)selectAllInFilePath;
- (NSMutableArray *)selectAllInLoading;

@end
